cmake_minimum_required(VERSION 3.14)

project(QmlDemo LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(taoQuick.cmake)

set(QT_DIR "D:/SoftWare/Qt/5.15.2/mingw81_64/lib/cmake/Qt5")
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick REQUIRED)
set(Qt${QT_VERSION_MAJOR}_DIR ${QT_DIR})
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick REQUIRED)

include_directories(${PROJECT_SOURCE_DIR}/Src/TaoCommon)

link_directories(${PROJECT_SOURCE_DIR}/lib)

file(GLOB MAIN ${PROJECT_SOURCE_DIR}/main.cpp)
file(GLOB_RECURSE CPP_SOURCES ${PROJECT_SOURCE_DIR}/Src/*.cpp
                              ${PROJECT_SOURCE_DIR}/Src/*.h)                           
list(REMOVE_ITEM CPP_SOURCES ${PROJECT_SOURCE_DIR}/Src/TaoCommon/Frameless/TaoFrameLessView_unix.cpp)   
                
set (Res Qml.qrc)

add_definitions(-DTaoCommon_NO_LIB)

if (CMAKE_BUILD_TYPE MATCHES "Release")
  add_executable(QmlDemo
                ${MAIN}
                ${CPP_SOURCES}
                ${Res}
                ${TaoQuickRes}
                )
  add_compile_definitions(ProjectShowPath="qrc:/")
else()
  add_executable(QmlDemo
                ${MAIN}
                ${CPP_SOURCES}
                ${Res}
                ${TaoQuickRes}
                )
  add_compile_definitions(ProjectShowPath="file:///${CMAKE_CURRENT_SOURCE_DIR}/")
endif()
target_compile_definitions(QmlDemo
  PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(QmlDemo
  PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick dwmapi.lib)
 